package g4p.newg4p;

import g4p_controls.G4P;
import g4p_controls.GAlign;
import g4p_controls.GCScheme;
import g4p_controls.GCheckbox;
import g4p_controls.GEvent;
import processing.core.PApplet;
import processing.core.PImage;

public class ToggleSwitch extends PApplet {

	PImage img;
	
	public void setup(){
		  size(480, 320, JAVA2D);
		  img = loadImage("g4p/switch.jpg");
		  System.out.println(img.toString());
		  createGUI();
		  customGUI();
		  // Place your setup code here
		  
		}

		public void draw(){
		  background(230);
		  
		}

		// Use this method to add additional statements
		// to customise the GUI controls
		public void customGUI(){
		  mySwitch.setIcon("g4p/switch.jpg", 2, null, null);
		  mySwitch.setTextAlign(GAlign.LEFT, null);

		}
		
		
		/* =========================================================
		 * ====                   WARNING                        ===
		 * =========================================================
		 * The code in this tab has been generated from the GUI form
		 * designer and care should be taken when editing this file.
		 * Only add/edit code inside the event handlers i.e. only
		 * use lines between the matching comment tags. e.g.

		 void myBtnEvents(GButton button) { //_CODE_:button1:12356:
		     // It is safe to enter your event code here  
		 } //_CODE_:button1:12356:
		 
		 * Do not rename this tab!
		 * =========================================================
		 */

		public void switch_clicked(GCheckbox source, GEvent event) { //_CODE_:mySwitch:429373:
		  println("checkbox1 - GCheckbox event occured " + System.currentTimeMillis()%10000000 );
		} //_CODE_:mySwitch:429373:



		// Create all the GUI controls. 
		// autogenerated do not edit
		public void createGUI(){
		  G4P.messagesEnabled(false);
		  G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
		  G4P.setCursor(ARROW);
		  if(frame != null)
		    frame.setTitle("Sketch Window");
		  mySwitch = new GCheckbox(this, 109, 62, 60, 36);
		  mySwitch.setText(" ");
		  mySwitch.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
		  mySwitch.setOpaque(false);
		  mySwitch.addEventHandler(this, "switch_clicked");
		}

		// Variable declarations 
		// autogenerated do not edit
		GCheckbox mySwitch; 

}
